# 新建节点同步工具
import requests
from config import BLOCKCHAIN_CONFIG

def broadcast_to_nodes(data):
    for node in BLOCKCHAIN_CONFIG['nodes']:
        try:
            requests.post(f"{node}/sync", 
                json=data,
                timeout=BLOCKCHAIN_CONFIG['sync_timeout']
            )
        except Exception as e:
            print(f"节点 {node} 同步失败: {str(e)}")
